import { ApiProperty } from '@midwayjs/swagger';
import { Rule, RuleType } from '@midwayjs/validate';
import { Column, Entity, PrimaryColumn } from 'typeorm';
@Entity('admin')
export class Admin {
  @ApiProperty({
    type: 'string',
    example: 'admin',
  })
  @PrimaryColumn()
  @Rule(RuleType.string().required())
  adminId: string;
  @Column()
  @Rule(RuleType.string())
  password: string;
  @ApiProperty({
    type: 'string',
    example: '管理员',
  })
  @Column()
  @Rule(RuleType.string().required())
  name: string;
  @Column({ nullable: true })
  @Rule(RuleType.string().allow(null))
  @ApiProperty({
    type: 'string',
    example: '123456',
  })
  profile_picture: string;
}
@Entity('token')
export class Token {
  @ApiProperty({
    type: 'string',
    example: 'admin',
  })
  @PrimaryColumn()
  @Rule(RuleType.string().required())
  token: string;
}
export class AdminEditDto {
  @ApiProperty({
    type: 'string',
    example: 'admin',
  })
  @Rule(RuleType.string().required())
  adminId: string;
  @ApiProperty({
    type: 'string',
    example: '管理员',
  })
  @Rule(RuleType.string().required())
  name: string;
  @Rule(RuleType.string().allow(null))
  @ApiProperty({
    type: 'string',
    example: '123456',
  })
  profile_picture: string;
}
